import request from '@/utils/request'

// 查询主体列表
export function listSubject(query) {
  return request({
    url: '/system/subject/list',
    method: 'get',
    params: query
  })
}

// 查询主体列表（排除节点）
export function listSubjectExcludeChild(subjectId) {
  return request({
    url: '/system/subject/list/exclude/' + subjectId,
    method: 'get'
  })
}

// 运营商查询主体详细
export function subjectInfo() {
  return request({
    url: '/system/subject/getInfo',
    method: 'get',
  })
}

// 管理员查询主体详细
export function getSubject(subjectId) {
  return request({
    url: '/system/subject/' + subjectId,
    method: 'get'
  })
}

// 新增主体
export function addSubject(data) {
  return request({
    url: '/system/subject',
    method: 'post',
    data: data
  })
}

// 修改主体
export function updateSubject(data) {
  return request({
    url: '/system/subject',
    method: 'put',
    data: data
  })
}

// 删除主体
export function delSubject(subjectId) {
  return request({
    url: '/system/subject/' + subjectId,
    method: 'delete'
  })
}

// 注册二维码
export function createRegCode() {
  return request({
    url: '/xcx/regCode',
    method: 'get'
  })
}

export function withdrawal(data) {
  return request({
    url: '/system/subject/withdrawal',
    method: 'post',
    data: data
  })
}